home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-02-27 | 10.4 KB | 370 lines | [TEXT/BROW] |
- # Script For CIncludes Tool - by John Jeppson
- # modified for use with ObjectMaster
-
- Set Exit 0
- Set param 0
- Set toolStatus 0
-
- If {#} == 1
- If ("{1}" == "-m") || ("{1}" == "-M")
- Set param 1
- Else If ("{1}" == "-f") || ("{1}" == "-F")
- Set param 2
- Else If ("{1}" == "-i") || ("{1}" == "-I")
- Set param 3
- Else If ("{1}" == "-d") || ("{1}" == "-D") # Daniel Grassi
- Set param 4
- End
- End
-
- If {param} == 0
- OMAlert "OMCIncludesTool - Usage :CIncludesTool [-f -m -i -d]∂n ∂
- -f Locates selection from active window∂n ∂
- -m Rebuilds the CIncludes identifier dictionary∂n ∂
- -i Reformats ∂"#include∂" statements in selection∂n ∂
- -d Displays the file declaring the selection"
-
- Else If {param} == 1
- ## Find §:/∞/ "{Active}"
- ## Find §Δ "{Active}"
- ## Echo
-
- If ("{CIncludesCompiler}" == 'AppleCFront')
- Set j "`Quote "{CIncludes}"`≈.h"
- Begin
- Set SrchList ""
- Set j "`Quote "{CIncludes}"`≈.h"
- If ("`Exists -f {j}`" != "")
- Set SrchList "`Quote "{CIncludes}"`≈.h"
- Else
- Set SrchList ""
- End # If Exists
- End ≥ Dev:Null
- For j in `Files -fr -d -r -o "{CIncludes}"`
- If ("`Exists -f "{j}"≈.h`" != "")
- Set j "`Quote "{j}"`"
- Set SrchList "{SrchList} {j}≈.h"
- End # If Exists
- End ∑ Dev:Null # For j
- If ({MACPlusIncludes} != "")
- Begin
- Set SrchList2 ""
- Set j "`Quote "{MACPlusIncludes}"`≈.h"
- If ("`Exists -f {j}`" != "")
- Set SrchList2 "`Quote "{MaCPLusIncludes}"`≈.h"
- Else
- Set SrchList2 ""
- End # If Exists
- End ≥ Dev:Null
- For j in `Files -fr -d -r -o "{MACPlusIncludes}"`
- If ("`Exists -f "{j}"≈.h`" != "")
- Set j "`Quote "{j}"`"
- Set SrchList2 "{SrchList2} {j}≈.h"
- End # If Exists
- End ∑ Dev:Null # For j
- CIncludesCode -m `Files -fr {SrchList} {SrchList2}`
- Unset SrchList2
- Else
- CIncludesCode -m `Files -fr {SrchList}`
- End # If
- Else
- If ("{CIncludesCompiler}" == 'SymantecC++')
- Begin
- Set SrchList ""
- Set j "`Quote "{SCIncludes}"`≈.h"
- If ("`Exists -f {j}`" != "")
- Set SrchList "`Quote "{SCIncludes}"`≈.h"
- Else
- Set SrchList ""
- End # If Exists
- End ≥ Dev:Null
- For j in `Files -fr -d -r -o "{SCIncludes}"`
- If ("`Exists -f "{j}"≈.h`" != "")
- Set j "`Quote "{j}"`"
- Set SrchList "{SrchList} {j}≈.h"
- End # If Exists
- End ∑ Dev:Null # For j
- If ({MASCPlusIncludes} != "")
- Begin
- Set SrchList2 ""
- Set j "`Quote "{MASCPlusIncludes}"`≈.h"
- If ("`Exists -f {j}`" != "")
- Set SrchList2 "`Quote "{MASCPlusIncludes}"`≈.h"
- Else
- Set SrchList2 ""
- End # If Exists
- End ≥ Dev:Null
- For j in `Files -fr -d -r -o "{MASCPlusIncludes}"`
- If ("`Exists -f "{j}"≈.h`" != "")
- Set j "`Quote "{j}"`"
- Set SrchList2 "{SrchList2} {j}≈.h"
- End # If Exists
- End ∑ Dev:Null # For j
- CIncludesCode -m `Files -fr {SrchList} {SrchList2}`
- Unset SrchList2
- Else
- CIncludesCode -m `Files -fr {SrchList}`
- End # If
- Else
- If ("{CIncludesCompiler}" == 'MetrowerksC++')
- Begin
- Set SrchList ""
- Set j "`Quote "{MWIncludes}"`≈.h"
- If ("`Exists -f {j}`" != "")
- Set SrchList "`Quote "{MWIncludes}"`≈.h"
- Else
- Set SrchList ""
- End # If Exists
- End ≥ Dev:Null
- For j in `Files -fr -d -r -o "{MWIncludes}"`
- If ("`Exists -f "{j}"≈.h`" != "")
- Set j "`Quote "{j}"`"
- Set SrchList "{SrchList} {j}≈.h"
- End # If Exists
- End ∑ Dev:Null # For j
- If ({MAMCPlusIncludes} != "")
- Set j "`Quote "{MAMCPlusIncludes}"`≈.h"
- Begin
- Set SrchList2 ""
- Set j "`Quote "{MAMCPlusIncludes}"`≈.h"
- If ("`Exists -f {j}`" != "")
- Set SrchList2 "`Quote "{MAMCPlusIncludes}"`≈.h"
- Else
- Set SrchList2 ""
- End # If Exists
- End ≥ Dev:Null
- For j in `Files -fr -d -r -o "{MAMCPlusIncludes}"`
- If ("`Exists -f "{j}"≈.h`" != "")
- Set j "`Quote "{j}"`"
- Set SrchList2 "{SrchList2} {j}≈.h"
- End # If Exists
- End ∑ Dev:Null # For j
- CIncludesCode -m `Files -fr {SrchList} {SrchList2}`
- Unset SrchList2
- Else
- CIncludesCode -m `Files -fr {SrchList}`
- End # If
- End # If
- End # If
- End # If
-
- Unset SrchList
- Set toolStatus "{Status}"
- Beep 2C,20,128
-
- Else If {param} == 2
- ## Mark -y § x162534 "{Active}"
-
- Set str "`OM_SendAE GSEL %Text`"
- CIncludesCode -v "{str}"
- Set toolStatus "{Status}"
-
- If {toolStatus} == 0
- ## Find • "{Active}"
- ## Find Δ/#include/ "{Active}" # Daniel Grassi
- ## CIncludesCode -f "{str}"
- ## Set toolStatus "{Status}"
- ## replacement (different functionality) from above
- Set counter 1
- For i in `CIncludesCode -d "{str}"`
- If {counter} == 1
- OMAlert "Header file is {i}"
- Set counter 2
- End # If {counter}
- End # For i
- End # If {ToolStatus}
-
- ## Find x162534 "{Active}"
- ## Unmark x162534 "{Active}"
-
- Else If {param} == 3
- ## CIncludesCode -i "{Active}.§"
- ## Set toolStatus "{Status}"
- OMAlert "{0} :∂n∂noption -i (reformating selected include statements) is not supported in ObjectMaster."
-
- Else If {param} == 4 # Daniel Grassi
- Set str "`OM_SendAE GSEL %Text`"
- CIncludesCode -v "{str}"
- Set toolStatus "{Status}"
-
- If {toolStatus} == 0
- Set counter 1
- For i in `CIncludesCode -d "{str}"`
- If {counter} == 1
-
- If ("{CIncludesCompiler}" == 'AppleCFront')
- Set SrchList "`Quote "{CIncludes}{i}"`"
- For j in `Files -fr -d -r "{CIncludes}"`
- Set j "`Quote "{j}"`"
- Set SrchList "{SrchList} {j}{i}"
- End ∑ Dev:Null # For j
-
- For j in {SrchList}
- ## Open -r "{j}" ∑∑ Dev:Null
- Set j "`Quote "{j}"`"
- If ("`Exists -f {j}`" != "")
- OM_SendAE LINE -FILEalis {j}
- If ({Status} == 0)
- Set FoundIt 1
- Set HeaderName "{j}"
- Break
- End # If {Status}
- End # If Exists
- End ∑ Dev:Null # For j
- Unset SrchList
-
- If ({FoundIt} == 0)
- Set SrchList "`Quote "{MACPlusIncludes}{i}"`"
- For j in `Files -fr -d -r "{MACPlusIncludes}"`
- Set j "`Quote "{j}"`"
- Set SrchList "{SrchList} {j}{i}"
- End ∑ Dev:Null # For j
- For j in {SrchList}
- ## Open -r "{j}" ∑∑ Dev:Null
- Set j "`Quote "{j}"`"
- If ("`Exists -f {j}`" != "")
- OM_SendAE LINE -FILEalis {j}
- If ({Status} == 0)
- Set FoundIt 1
- Set HeaderName "{j}"
- Break
- End # If {Status}
- End # If Exists
- End ∑ Dev:Null # For j
- Unset SrchList
- If ({FoundIt} == 0)
- OMAlert "Unable to open the header file {i}"
- End # If {Status}
- End # If {Status}
- Else
- If ("{CIncludesCompiler}" == 'SymantecC++')
- Set SrchList "`Quote "{SCIncludes}{i}"`"
- For j in `Files -fr -d -r "{SCIncludes}"`
- Set j "`Quote "{j}"`"
- Set SrchList "{SrchList} {j}{i}"
- End ∑ Dev:Null # For j
-
- For j in {SrchList}
- ## Open -r "{j}" ∑∑ Dev:Null
- Set j "`Quote "{j}"`"
- If ("`Exists -f {j}`" != "")
- OM_SendAE LINE -FILEalis {j}
- If ({Status} == 0)
- Set FoundIt 1
- Set HeaderName "{j}"
- Break
- End # If {Status}
- End # If Exists
- End ∑ Dev:Null # For j
- Unset SrchList
-
- If ({FoundIt} == 0)
- Set SrchList "`Quote "{MASCPlusIncludes}{i}"`"
- For j in `Files -fr -d -r "{MASCPlusIncludes}"`
- Set j "`Quote "{j}"`"
- Set SrchList "{SrchList} {j}{i}"
- End ∑ Dev:Null # For j
- For j in {SrchList}
- ## Open -r "{j}" ∑∑ Dev:Null
- Set j "`Quote "{j}"`"
- If ("`Exists -f {j}`" != "")
- OM_SendAE LINE -FILEalis {j}
- If ({Status} == 0)
- Set FoundIt 1
- Set HeaderName "{j}"
- Break
- End # If {Status}
- End # If Exists
- End ∑ Dev:Null # For j
- Unset SrchList
- If ({FoundIt} == 0)
- OMAlert "Unable to open the header file {i}"
- End # If {Status}
- End # If {Status}
- Else
- If ("{CIncludesCompiler}" == 'MetrowerksC++')
- Set SrchList "`Quote "{MWIncludes}{i}"`"
- For j in `Files -fr -d -r "{MWIncludes}"`
- Set j "`Quote "{j}"`"
- Set SrchList "{SrchList} {j}{i}"
- End ∑ Dev:Null # For j
-
- For j in {SrchList}
- ## Open -r "{j}" ∑∑ Dev:Null
- Set j "`Quote "{j}"`"
- If ("`Exists -f {j}`" != "")
- OM_SendAE LINE -FILEalis {j}
- If ({Status} == 0)
- Set FoundIt 1
- Set HeaderName "{j}"
- Break
- End # If {Status}
- End # If Exists
- End ∑ Dev:Null # For j
- Unset SrchList
-
- If ({FoundIt} == 0)
- Set SrchList "`Quote "{MAMCPlusIncludes}{i}"`"
- For j in `Files -fr -d -r "{MAMCPlusIncludes}"`
- Set j "`Quote "{j}"`"
- Set SrchList "{SrchList} {j}{i}"
- End ∑ Dev:Null # For j
- For j in {SrchList}
- ## Open -r "{j}" ∑∑ Dev:Null
- Set j "`Quote "{j}"`"
- If ("`Exists -f {j}`" != "")
- OM_SendAE LINE -FILEalis {j}
- If ({Status} == 0)
- Set FoundIt 1
- Set HeaderName "{j}"
- Break
- End # If {Status}
- End # If Exists
- End ∑ Dev:Null # For j
- Unset SrchList
- If ({FoundIt} == 0)
- OMAlert "Unable to open the header file {i}"
- End # If {Status}
- End # If {Status}
- End # If
- End # If
- End # If
-
- Set counter 2
- Else
- ## Find •!{i} "{Active}"
- ## Find \{str}\ "{Active}" ∑∑ Dev:Null
- ### OM_SendAE LINE -OFFSlong "{i}" '-LEN long' 0 -FILEalis "{HeaderName}"
- Set HeaderName "`Quote {HeaderName}`"
- Set LineNo "`FilePosToLine {HeaderName} "{i}"`"
- OM_SendAE LINE -FILEalis {HeaderName} -LINElong {LineNo}
- End
- End
- If ("{i}" == "")
- Set toolStatus 4 # new - signal that no identifiers were found
- Else
- Set toolStatus "{Status}"
- End # If {i}
- End
- End
-
-
- If {toolStatus}
- If {toolStatus} == '1'
- OMAlert 'Bad parameters to "OMCIncludesCode"' # won't occur here
- Else If {toolStatus} == '2'
- OMAlert 'Invalid Identifier!'
- Else If {toolStatus} == '3'
- If ({param} == 2) || (param} == 3)
- OMAlert 'Unable to load database resource!'
- Else
- OMAlert 'Out of memory error!'
- End
- Else If {toolStatus} == '4'
- OMAlert 'Identifier not found in CIncludes!'
- Else
- OMAlert "Unknown CIncludes error return value ({toolStatus})."
- End
- End
-
- # end of OMCIncludesTool